<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb">
        <a lay-href="">主页</a>
        <a><cite>支付分账详情</cite></a>
    </div>
</div>
<style>
    .xxpayPopupDiv .layui-form-label {
        width:15% !important;
        margin-left:1%;
    }
    .xxpayPopupDiv .layui-input-inline {
        width: 33% !important;
        margin-top:0px;
    }
</style>
<div class="layui-fluid">
  <div class="layui-card">
    <div class="layui-tab layui-tab-brief">
      <ul class="layui-tab-title">
        <li class="layui-this">分账详情</li>
      </ul>
      <div class="layui-tab-content">
          <form class="layui-form layui-form-pane" action="">

              <div class="layui-form-item">
                  <label class="layui-form-label">系统用户号</label>
                  <div class="layui-input-inline">
                      <input type="text" id="infoId" disabled="disabled" class="layui-input">
                  </div>
                  <label class="layui-form-label">用户类型</label>
                  <div class="layui-input-inline">
                      <input type="text" id="infoType" disabled="disabled" class="layui-input">
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">渠道接口代码</label>
                  <div class="layui-input-inline">
                      <input type="text" id="ifTypeCode" disabled="disabled" class="layui-input">
                  </div>
                  <label class="layui-form-label">上游渠道商户号</label>
                  <div class="layui-input-inline">
                      <input type="text" id="channelMchId" disabled="disabled" class="layui-input">
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">上游分账订单号</label>
                  <div class="layui-input-inline">
                      <input type="text" id="channelOrderId" disabled="disabled" class="layui-input">
                  </div>
                  <label class="layui-form-label">支付订单号</label>
                  <div class="layui-input-inline">
                      <input type="text" id="payOrderId" disabled="disabled" class="layui-input">
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">分账金额</label>
                  <div class="layui-input-inline">
                      <input type="text" id="divisionAmount" disabled="disabled" class="layui-input">
                  </div>
                  <label class="layui-form-label">分账状态</label>
                  <div class="layui-input-inline">
                      <input type="text" id="status" disabled="disabled" class="layui-input">
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">上游分账失败原因</label>
                  <div class="layui-input-inline">
                      <input type="text" id="channelErrorMsg" disabled="disabled" class="layui-input">
                  </div>
                  <label class="layui-form-label">最后一次通知时间</label>
                  <div class="layui-input-inline">
                      <input type="text" id="lastNotifyTime" disabled="disabled" class="layui-input">
                  </div>
              </div>

              <div class="layui-form-item">
                  <label class="layui-form-label">创建时间</label>
                  <div class="layui-input-inline">
                      <input type="text" id="createTime" disabled="disabled" class="layui-input">
                  </div>
                  <label class="layui-form-label">更新时间</label>
                  <div class="layui-input-inline">
                      <input type="text" id="updateTime" disabled="disabled" class="layui-input">
                  </div>
              </div>

          </form>
      </div>
    </div>
  </div>
</div>

<script>
    layui.use(['admin','form'],function(){
        var form = layui.form
        ,$ = layui.$
        ,admin = layui.admin
        ,element = layui.element
        ,view = layui.view
        ,layer = layui.layer ;
        // 导航
        element.render('breadcrumb', 'breadcrumb');
        var recordId = view.getOpenParams('recordId');
        admin.req({
            type: 'get',
            url: layui.setter.baseUrl + '/pay_division_record/get/' + recordId,
            error: function(err){
                layer.alert(JSON.stringify(err.field), {
                    title: '错误提示'
                })
            },
            success: function(res){
                if(res.code == 0){
                    $('#infoId').val(res.data.infoId);
                    $('#infoType').val( res.data.infoType =="1" ? "代理商": res.data.infoType=="2" ? "商户":"平台" );
                    $('#ifTypeCode').val(res.data.ifTypeCode);
                    $('#channelMchId').val(res.data.channelMchId);
                    $('#channelOrderId').val(res.data.channelOrderId);
                    $('#payOrderId').val(res.data.payOrderId);
                    $('#divisionAmount').val(res.data.divisionAmount / 100);

                    if(res.data.status == 0) {
                        $('#status').val("待分账");
                    }else if(res.data.status == 1) {
                        $('#status').val("分账处理中");
                    }else if(res.data.status == 2) {
                        $('#status').val("成功");
                    }else if(res.data.status == 3) {
                        $('#status').val("失败");
                    }
                    $('#channelErrorMsg').val(res.data.channelErrorMsg);

                    if(res.data.lastNotifyTime != "" && res.data.lastNotifyTime != null) {
                        $('#lastNotifyTime').val(layui.util.toDateString(res.data.lastNotifyTime));
                    }
                    if(res.data.createTime != "" && res.data.createTime != null) {
                        $('#createTime').val(layui.util.toDateString(res.data.createTime));
                    }
                    if(res.data.updateTime != "" && res.data.updateTime != null) {
                        $('#updateTime').val(layui.util.toDateString(res.data.updateTime));
                    }
                    form.render();
                }
            }
        })
    })
</script>